package com.example.zydraw.draw;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.Log;

public class LineDrawPolicy implements IDrawPolicy {

    private final PaintRecord paintRecord = new PaintRecord();
    private final RoleRecord roleRecord = new RoleRecord();
    private final Paint paint = paintRecord.toPaint();


    @Override
    public void draw(Canvas canvas) {
        Log.d("LineDrawPolicy", "" + paintRecord);
        paintRecord.update(paint);
        canvas.drawLine(roleRecord.getStartX(), roleRecord.getStartY(), roleRecord.getEndX(), roleRecord.getEndY(), paint);
    }

    @Override
    public PaintRecord getPaintRecord() {
        return paintRecord;
    }

    @Override
    public RoleRecord getRoleRecord() {
        return roleRecord;
    }
}
